package com.zsj.qzt_punch.config;

import com.zsj.qzt_punch.pojo.Result;
import com.zsj.qzt_punch.script.PunchScript;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Component
@Slf4j
public class AppListener implements CommandLineRunner, DisposableBean {


    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

    //项目启动时的方法
    @Override
    public void run(String... args) throws Exception {
        log.info("(监听器)程序启动时间为:{}", format.format(new Date()));
    }


    @Override
    public void destroy() throws Exception {
        log.info("(监听器)程序关闭时间为:{}", format.format(new Date()));
        log.info("(监听器)成功请求的次数为{}次", PunchScript.REQUEST_SUCCESSFUL_COUNT);
    }
}
